/*
* @(#)LabelManager.java
*
* Copyright (c) 2003 DCIVision Ltd
* All rights reserved.
*
* This software is the confidential and proprietary information of DCIVision
* Ltd ("Confidential Information").  You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the license
* agreement you entered into with DCIVision Ltd.
*/
package com.dcivision.dms.core;

import java.sql.Connection;

import com.dcivision.dms.bean.DmsVersion;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.SessionContainer;
/**
 * <p>Class Name:       LabelManager.java    </p>
 * <p>Description:      The class mainly handles the version label increment processes. </p>
 * @author              Zoe Shum
 * @company             DCIVision Limited
 * @creation date       01/08/2003
 * @version             $Revision: 1.4 $
 */
public class LabelManager {

  public static final String REVISION = "$Revision: 1.4 $";


    public static final String DEFAULT_LABEL_RULE = "DEFAULT";

    private SessionContainer sessionContainer;
    private Connection conn;
    private DmsVersion version;
    private VersionLabelRule labelRule;

    public LabelManager(SessionContainer sessionCtx, Connection conn) {
        this(new StandardVersionLabelRule(sessionCtx, conn) , sessionCtx, conn);

    }

    public LabelManager(VersionLabelRule labelRule, SessionContainer sessionCtx, Connection conn) {
        this.labelRule = labelRule;
        this.sessionContainer = sessionCtx;
        this.conn = conn;
    }

    /**
      *  Release - To release the variable in instance of LabelManager
      */
     public void release () {
       this.sessionContainer = null;
       this.conn = null;
     }

    public void setVersion(DmsVersion version) {
        this.version = version;
    }

    public void setLabelRule(VersionLabelRule labelRule) {
        this.labelRule = labelRule;
    }

    public void process() throws ApplicationException {
        labelRule.process(version);
    }
}
